package rep

import (
	"DuckShop/internal/user/database/model"
	"DuckShop/internal/user/proto/users"
	"google.golang.org/protobuf/types/known/timestamppb"
)

// CovertRPCUserToModel gorm model 转为 rpc struct
func CovertRPCUserToModel(user *model.DuckUser) *users.User {
	return &users.User{
		Id:        uint64(user.ID),
		IsDeleted: user.IsDeleted,
		UserId:    uint64(user.UserID),
		Username:  user.Username,
		Mobile:    user.Mobile,
		Password:  user.Password,
		Nickname:  user.Nickname,
		Birthday:  timestamppb.New(user.Birthday),
		Gender:    user.Gender,
		Role:      user.Role,
	}
}
